﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site/HeThongSpa.Master" AutoEventWireup="true" CodeBehind="DanhSachKhachHang.aspx.cs" Inherits="HeThongSpa.QuanLyKhachHang.KhachHang.DanhSachKhachHang" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Danh sách khách hàng
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
    <div id="thongtinkhachang" class="box collapsed-box">
        <div class="box-header with-border">
            <h3 class="box-title">Thông tin khách hàng</h3>
            <div class="box-tools pull-right">
                <button type="button" class="btn btn-box-tool" data-widget="collapse">
                    <i class="fa fa-plus"></i>
                </button>
            </div>
        </div>
        <div class="box-body" style="padding-bottom: 0;">
            <div class="row">
                <div class="col-xs-12 col-sm-3 col-md-2">
                    <div class="form-group form-group-sm">
                        <label>Ngày đến&nbsp;<span style="color: #D73925;">*</span></label>
                        <div class="input-group date inputdate">
                            <asp:TextBox ID="txtNgayDen" runat="server" CssClass="form-control dateformat" placeholder="Ngày đến" MaxLength="10"></asp:TextBox>
                            <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                        </div>
                    </div>
                </div>
                <div class="col-xs-12 col-sm-3 col-md-4">
                    <div class="form-group form-group-sm">
                        <label>Họ tên&nbsp;<span style="color: #D73925;">*</span></label>
                        <asp:TextBox ID="txtHoTen" runat="server" CssClass="form-control" placeholder="Họ tên" MaxLength="150"></asp:TextBox>
                    </div>
                </div>
                <div class="col-xs-12 col-sm-3 col-md-2">
                    <div class="form-group form-group-sm">
                        <label>Ngày sinh&nbsp;<span style="color: #D73925;">*</span></label>
                        <div class="input-group date inputdate">
                            <asp:TextBox ID="txtNgaySinh" runat="server" CssClass="form-control dateformat" placeholder="Ngày sinh" MaxLength="10"></asp:TextBox>
                            <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                        </div>
                    </div>
                </div>
                <div class="col-xs-12 col-sm-3 col-md-2">
                    <div class="form-group form-group-sm">
                        <label>Giới tính</label>
                        <asp:DropDownList runat="server" ID="ddlGioiTinh">
                            <asp:ListItem Value="False" Selected="True">Nữ</asp:ListItem>
                            <asp:ListItem Value="True">Nam</asp:ListItem>
                        </asp:DropDownList>
                    </div>
                </div>
                <div class="col-xs-12 col-sm-3 col-md-2">
                    <div class="form-group form-group-sm">
                        <label>Điện thoại&nbsp;<span style="color: #D73925;">*</span></label>
                        <asp:TextBox ID="txtDienThoai" runat="server" CssClass="form-control numberformat" placeholder="Điện thoại" MaxLength="11"></asp:TextBox>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 col-sm-3 col-md-6">
                    <div class="form-group form-group-sm">
                        <label>Địa chỉ</label>
                        <asp:TextBox ID="txtDiaChi" runat="server" CssClass="form-control" placeholder="Địa chỉ" MaxLength="250"></asp:TextBox>
                    </div>
                </div>
                <div class="col-xs-12 col-sm-3 col-md-4">
                    <div class="form-group form-group-sm">
                        <label>Email</label>
                        <asp:TextBox ID="txtEmail" runat="server" CssClass="form-control" placeholder="Email" MaxLength="50"></asp:TextBox>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-footer">
            <asp:Button ID="btnLuu" CssClass="btn btn-primary btn-sm btn-flat" runat="server" Text="Lưu"
                OnClientClick=" validationform() " OnClick="btnLuu_Click" />
            <asp:Button ID="btnNhapLai" CssClass="btn btn-warning btn-sm btn-flat" runat="server" Text="Nhập lại"
                OnClientClick=" $('#form_Main').validate().cancelSubmit = true; " OnClick="btnNhapLai_Click" />
        </div>
    </div>
    <div class="box">
        <div class="box-header with-border">
            <h3 class="box-title">Danh sách khách hàng</h3>
            <div class="box-tools pull-right">
                <button type="button" class="btn btn-box-tool" data-widget="collapse">
                    <i class="fa fa-minus"></i>
                </button>
            </div>
        </div>
        <div class="box-body">
            <div class="row">
                <div class="form-horizontal">
                    <div class="col-xs-12 col-sm-6 col-md-3">
                        <div class="input-group input-group-sm">
                            <span class="input-group-addon">Từ ngày</span>
                            <asp:TextBox ID="txtTuNgay" runat="server" CssClass="form-control inputdate dateformat" MaxLength="10"></asp:TextBox>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6 col-md-3">
                        <div class="input-group input-group-sm">
                            <span class="input-group-addon">Đến ngày</span>
                            <asp:TextBox ID="txtDenNgay" runat="server" CssClass="form-control inputdate dateformat" MaxLength="10"></asp:TextBox>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6 col-md-4">
                        <div class="input-group input-group-sm">
                            <span class="input-group-addon">Từ khóa</span>
                            <asp:TextBox ID="txtTuKhoa" runat="server" CssClass="form-control" placeholder="Mã hoặc tên khách hàng" MaxLength="200"></asp:TextBox>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6 col-md-2">
                        <div class="form-group">
                            <asp:Button ID="btnTimKiem" CssClass="btn btn-success btn-sm btn-flat" runat="server" Text="Tìm kiếm"
                                OnClientClick="validationform_Timkiem();" OnClick="btnTimKiem_Click" />
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12">
                    <div class="table-responsive">
                        <asp:GridView ID="gvDanhMuc" runat="server" AutoGenerateColumns="False" Width="100%" CssClass="table table-bordered table-condensed"
                            DataKeyNames="MaKhachHang" ShowHeaderWhenEmpty="True">
                            <EmptyDataTemplate>
                                <div class="row text-center">
                                    <label>Không có dữ hiện hiển thị</label>
                                </div>
                            </EmptyDataTemplate>
                            <Columns>
                                <asp:BoundField DataField="RowNumber" HeaderText="STT">
                                    <ItemStyle HorizontalAlign="Center" Width="5%"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField DataField="MaKhachHang" HeaderText="Mã khách hàng">
                                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField DataField="NgayDen" HeaderText="Ngày đến" DataFormatString="{0:dd-MM-yyyy}">
                                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField DataField="HoTen" HeaderText="Họ tên"></asp:BoundField>
                                <asp:BoundField DataField="NgaySinh" HeaderText="Ngày sinh" DataFormatString="{0:dd-MM-yyyy}">
                                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField DataField="GioiTinh" HeaderText="Ngày sinh">
                                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField DataField="DiaChi" HeaderText="Địa chỉ"></asp:BoundField>
                                <asp:BoundField DataField="DienThoai" HeaderText="Điện thoại">
                                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField DataField="Email" HeaderText="Email"></asp:BoundField>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="btnSua" runat="server" ToolTip="Sửa" CssClass="btn btn-success btn-xs btn-flat"
                                            CommandArgument='<%# Eval("MaKhachHang") %>' OnClick="btnSua_Click" OnClientClick=" $('#form_Main').validate().cancelSubmit = true; ">
                                            <i class="glyphicon glyphicon-edit"></i>
                                        </asp:LinkButton>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="5%" />
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12">
                    <asp:DataList RepeatDirection="Horizontal" runat="server" ID="dlPager" OnItemCommand="dlPager_ItemCommand"
                        CssClass="tbPage">
                        <ItemTemplate>
                            <asp:LinkButton Enabled='<%#Eval("Enabled") %>' runat="server" ID="lnkPageNo" Text='<%#Eval("Text") %>'
                                CommandArgument='<%#Eval("Value") %>' CommandName="PageNo">
                            </asp:LinkButton>
                        </ItemTemplate>
                    </asp:DataList>
                </div>
            </div>
        </div>
    </div>
    <asp:HiddenField ID="hfMaKhachHang" runat="server" Value="" />
    <asp:HiddenField ID="hfTimKiem" runat="server" Value="false" />
    <asp:HiddenField ID="hfPageIndex" runat="server" Value="1" />
    <script type="text/javascript">
        $(function () {
            $("#li_khachhang").addClass("active");
            $("#li_khachhang_danhsachkhachhang").addClass("active");
            $("#<%= txtTuKhoa.ClientID%>").focus();
        });

        function validationform() {
            $("#<%= txtNgayDen.ClientID %>").rules("add", { required: true, messages: { required: errempty } });
            $("#<%= txtHoTen.ClientID %>").rules("add", { required: true, messages: { required: errempty } });
            $("#<%= txtNgaySinh.ClientID %>").rules("add", { required: true, messages: { required: errempty } });
            $("#<%= txtDienThoai.ClientID %>").rules("add", { required: true, messages: { required: errempty } });
        }

        function validationform_Timkiem() {
            $("#<%= txtDenNgay.ClientID %>").rules("add", { datecompare: "#<%= txtTuNgay.ClientID %>" });
        }

        var confirmed = false;

        function showconfirm(controlId) {
            if (confirmed) return true;
            bootbox.confirm("Bạn có chắc chắn xóa?", function (result) {
                if (result) {
                    if (controlId != null) {
                        var controlToClick = document.getElementById(controlId);
                        if (controlToClick != null) {
                            confirmed = true;
                            $("#form_Main").validate().cancelSubmit = true;
                            controlToClick.click();
                            confirmed = false;
                        }
                    }
                }
            });
            return false;
        }
    </script>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="FormContent" runat="server">
</asp:Content>
